IBX-10186 Limit impact of heavy count queries on the CMS #2125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Warning
This PR does result in UI changes to the admin (Mainly surrounding the rendering of certain sub item counts by overall showing the limitations as given)
Also note the fact that everything in #2124 is still relevant to this PR. Read the description of that PR given it's chages are included in this PR
What
This PR leverages changes made in ezsystems/ezplatform-kernel#413 in order to limit the performance impact of loading sub item counts.
This includes:
EXISTSstyle queries to "1" instead of scanning the entire tablesubtree_operations.query_subtree.limit. Everywhere wherre a sub-item count is taken from the database has been updated to respect this new parameter. Always fetching thesubtree_operations.query_subtree.limit + 1and in the event of there being more than the limts worth of items adding a "+" to the end of the displayed value. This might beHow
This PR leverages the changes made in ezsystems/ezplatform-kernel#413 by fetching suitable amount of data when performing CMS fetches.
A default global limit has been set in configuration of 500 items for rendering "subitem" results. This should be enough to allow for CMS users to see all relevant values for the numbers in the sense that 4 -> 5 sub items is likely more important information than
565 -> 566given this value is configurable this cap can be removed as need be.For the UDW
'c-finder-leaf--has-children': !!location.childCount,is the only use case for the supplied subquery counts resulting in large amounts of DB overhead verses other given queriesWhy
The overhead of these count queries is significant in relation to the effects they have on the CMS. See a side by side view for the same request with and without this PR on a page with many sub items. Doctrine usage drops from 50% of the overall wall time for the CMS to load a request.

Checklist:
$ composer fix-cs)